﻿using NFine.Data;
using NFine.Domain._03_Entity.Biz;
using NFine.Domain._04_IRepository.Biz;

namespace NFine.Repository.Biz
{
    public class ZhongZhuanPinJianRepository : RepositoryBase<ZhongZhuanPinJianEntity>, IZhongZhuanPinJianRepository
    {
        /// <summary>
        /// 获取中转中心现有积分
        /// </summary>
        /// <param name="userid"></param>
        /// <returns></returns>
        public decimal GetZhZhJF(string userid)
        {
            return GetSingleToDecimal("SELECT   `F_Integral`FROM `biz_zhzh_pinjian` t  WHERE t.`F_UserID`='"+userid+ "' ORDER BY `F_CreateTime` DESC LIMIT 0, 1");
        }


        public bool InsertHG(ZhongZhuanPinJianEntity user, ZhongZhuanPinJianEntity zhzh)
        {
            using (var db = new RepositoryBase().BeginTrans())
            {
                db.Insert(user);
                db.Insert(zhzh);
                return db.Commit() > 0;
            }
        }
    }
}